-- 登录
sqlplus system/oracle@//localhost:1521/orcl

-- 登录修改密码等
sqlplus /nolog
connect sys/oracle as sysdba;
alter user sys identified by newpassword;
alter user system identified by newpassword;
ALTER   user leijmdas identified by leijmdas;

-- 创建用户和授权
create user leijmdas identified by leijmdas;
grant create session to leijmdas;
grant create table,unlimited tablespace to leijmdas;
grant select any table to leijmdas;
GRANT UPDATE ANY TABLE,DROP ANY TABLE,INSERT ANY TABLE TO leijmdas;
alter system set O7_DICTIONARY_ACCESSIBILITY=true scope=spfile;
-- 删除用户
drop user leijmdas cascade;

-- 查看实例
select instance_name from v$instance;
-- 查看表空间
select TABLESPACE_NAME, FILE_NAME from dba_data_files;
-- 创建表空间
create tablespace user_data logging datafile '/u01/app/oracle/oradata/xe/user_data01.dbf' size 50m autoextend on next 50m maxsize 20480m extent management local;
-- 查看临时表空间
select TABLESPACE_NAME, FILE_NAME from dba_temp_files;
-- 创建临时表空间
create temporary tablespace user_temp tempfile '/u01/app/oracle/oradata/xe/user_temp01.dbf' size 50m autoextend on next 50m maxsize 20480m extent management local;
-- 创建用户
create user username identified by password default tablespace user_data temporary tablespace user_temp;

-- 给用户授予权限
grant connect,resource,dba to leijmdas;